package com.brrbaii.common;

import lombok.Data;

/**
 * 返回类
 *
 *  Author : 白日日白
 */
@Data
public class BaseResponse<T> {
    /**
     * 返回状态码
     */
    private final int code;
    /**
     * 返回信息
     */
    private final T data;
    /**
     * 返回消息
     */
    private final String message;
    /**
     * 返回消息具体描述
     */
    private final String description;

    public BaseResponse(int code, T data, String message, String description) {
        this.code = code;
        this.data = data;
        this.message = message;
        this.description = description;
    }

    public BaseResponse(int code, T data) {
        this(code,data,"","");
    }

    public BaseResponse(int code, T data, String message) {
        this(code,data,message,"");
    }

    public BaseResponse(int code,String message,String description) {
        this(code,null,message,description);
    }

    public BaseResponse(ErrorCode errorCode,String description) {
        this(errorCode.getCode(),null,errorCode.getMessage(),description);
    }

    public BaseResponse(ErrorCode errorCode) {
        this(errorCode.getCode(),null,errorCode.getMessage(),"");
    }


}
